/* gears.h
 *
 * Copyright 2007-2008 OpenMoko, Inc.
 * Authored by Tick <tick@openmoko.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef __ASSASSIN_GEARS__
#define __ASSASSIN_GEARS__

#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Edje.h>
#include <etk/Etk.h>
#include <Eet.h>

#define FINISH_TIME_MAGIC  0.8f

#define BAR_HEIGHT  60
typedef void (* CallbackFunc) (void *data,  Evas_Object *obj, const char *emission, const char *source);

struct Installer_Alert {
    Evas_Object * alert;
    CallbackFunc  positive;
    CallbackFunc  negative;
    void * data;
};


struct Installer_Alert * new_Alert (Evas *evas, const char *type, const char *message, const char *icon_p, const char *icon_n, void *data);
int alert_set_callback(struct Installer_Alert *, CallbackFunc pos, CallbackFunc neg);
void free_Alert(struct Installer_Alert *AA);

struct Installer_Progressbar {
    Evas_Object *bar;
    int progress;
    char *text;
    int MAX;
    int WIDTH;
};

struct Installer_Progressbar * new_Progressbar(Evas *evas, const char *text);
unsigned int progressbar_update(struct Installer_Progressbar *, unsigned int p);
unsigned int progressbar_text_set(struct Installer_Progressbar *, const char *text);
unsigned int progressbar_increase(struct Installer_Progressbar *, int v);
void progressbar_animator_start(struct Installer_Progressbar *);
void progressbar_animator_stop(struct Installer_Progressbar *);
void free_Progressbar(struct Installer_Progressbar *);

struct Buttom_Bottons {
    Evas_Object *buttons;
    int selected;
};

struct Buttom_Bottons * new_button_bar(Evas *evas);
void auto_adjust_button_bar(struct Buttom_Bottons *bb);
void button_bar_back_arrow_show(int TF);
int get_button_bar_selected_type();

Evas_Object * new_package_view (Evas *evas, char *packageid);

struct Object_Shift {
    Evas_Object *obj;
    double finish_time;
    double start_time;
    int s_x;
    int s_y;
    int e_x;
    int e_y;
};

int WIDTH();
int HEIGHT();
void animator_move_object(Evas_Object *o, double time, int sx, int sy, int ex, int ey);

Evas_Object * assassin_edje_object_get(const char *name);
Evas_Object * _assassin_edje_object_get(Evas *, const char *name);

#define MAX_SCROLL_PAGE_TITLE_LENGTH 32
struct Scroll_Page {
    Evas_Object *frame;  // "assassin/v.scroll"
    int volatilize;
    void *embed;
    void (*free_embed) (void *embed);
    struct Scroll_Page *prev, *next;
};

struct Scroll_Page * scroll_page_new ();
void scroll_page_set_scrollable(struct Scroll_Page *sp, int ok);
void scroll_page_set_volatilize(struct Scroll_Page *sp, int v);
void scroll_page_set_title(struct Scroll_Page *sp, char *title);
void scroll_page_set_frame(struct Scroll_Page *sp, Evas_Object *obj);
void scroll_page_shows(struct Scroll_Page *sp);  // next page
void scroll_page_back();
void scroll_page_back_to_root();
struct Scroll_Page *current_scroll_page_get();
void scroll_page_del (struct Scroll_Page *sp);

void current_scroll_page_set(struct Scroll_Page *SP) ;

struct Scroll_List {
    Etk_Widget *embed;
    Etk_Widget *tree;
    Etk_Tree_Col *col;
    Evas_List *items;
};

struct Scroll_List * scroll_list_new (struct Scroll_Page *) ;
void scroll_list_clear(struct Scroll_List *);
Etk_Tree_Row * scroll_list_append(struct Scroll_List * SL, const char * title);

void put_a_mask_on_screen ();
void remove_the_mask_on_screen();
void put_a_dim_on_screen();
void remove_the_dim_on_screen();

Evas_Object * get_thumbnail_from_eet(const char *group, const char *pkgname) ;

enum MESSAGE_LEVEL {
    NORMAL_MESSAGE = 0,
    NORMAL_WARNING,
    NORMAL_ERROR,
    FATAL_ERROR
};

struct Message_Alert {
    Evas_Object *obj;
    int level;
    CallbackFunc cb;
};

void message_alert(char *message, int message_level, CallbackFunc cb) ;

struct Signalton_GUI_Items {
    Evas_Object *__the_mask_cover_on_screen__;
    struct Message_Alert *__message_alert_singalton__;
};

#endif
